home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Geek Games #12
/
GEGA012.iso
/
Jogos de Azar
/
1721-apuesten.swf
/
scripts
/
C_ChipsCLASS.as
< prev
next >
Wrap
Text File
|
2006-01-17
|
5KB
|
181 lines
_global.C_ChipsCLASS = function()
{
if(this.child_flag)
{
return undefined;
}
this.chipDepth = ++this.__proto__.chipsCounter + this.__proto__.globalChipDepth;
this.stop();
if(this.bet > 0)
{
this.setBet(this.bet);
}
};
C_ChipsCLASS.prototype = new MovieClip();
C_ChipsCLASS.prototype.chipsCounter = 0;
C_ChipsCLASS.prototype.globalChipDepth = 1500;
C_ChipsCLASS.prototype.multyLine = false;
C_ChipsCLASS.prototype.ChNominals = new Array(1000,500,100,25,5,1,0.5);
C_ChipsCLASS.prototype.Chwh = 40;
C_ChipsCLASS.prototype.scaleParam = 100;
C_ChipsCLASS.prototype.topSymbol = "chip_OFF";
C_ChipsCLASS.prototype.createPlace = function(noEffects)
{
if(!this.place)
{
this.place = this.duplicateMovieClip(this._name + "_New",this.chipDepth);
this.place.swapDepths(this);
this.place.child_flag = true;
}
else
{
this.place.gotoAndStop(1);
this.place.Targ.removeMovieClip();
this.place.topMC.removeMovieClip();
this.place.copy(this);
}
if(!noEffects)
{
this.place._br = this.place._brightness = 50;
this.place.onEnterFrame = function()
{
this._br -= 10;
this._brightness = this._br;
if(this._br <= 0)
{
this.place._brightness = 0;
delete this.place._br;
delete this.onEnterFrame;
}
};
}
this.place._xscale = this.place._yscale = this.scaleParam;
this.place.Targ_MC.duplicateMovieClip("Targ",10);
this.place.Targ_MC.duplicateMovieClip("topMC",20);
this.place.play();
};
C_ChipsCLASS.prototype.createTop = function(libraryId)
{
if(libraryId == undefined)
{
libraryId = this.topSymbol;
}
if(!this.place)
{
this.setBet(this.bet);
}
var o = this.place.topMC;
o.lib.removeMovieClip();
o.createEmptyMovieClip("lib",1000);
o.lib.creatSqv("tmp",123,1,0,true);
o.lib.align(this.lastChip);
o.lib.tmp.removeMovieClip();
o.lib.attachMovie(libraryId,"topSymbol",1000);
o.lib.movieBy(0,-3);
};
C_ChipsCLASS.prototype.clearTop = function()
{
this.createTop("");
};
C_ChipsCLASS.prototype.setBet = function(bet, m, noSound)
{
if(noSound == undefined && bet == 0)
{
noSound = true;
}
this.createPlace(noSound);
if(m != undefined)
{
this.multyLine = m;
}
this.bet = Number(bet);
var CashChips = this.bet;
var ChArray = new Array();
var n = 0;
var i = 0;
while(i < this.ChNominals.length)
{
if(CashChips >= this.ChNominals[i])
{
var cRem = CashChips;
CashChips %= this.ChNominals[i];
ChArray[n] = new Array();
ChArray[n][0] = (cRem - CashChips) / this.ChNominals[i];
ChArray[n][1] = "chip_" + this.ChNominals[i];
if(this.ChNominals[i] == 0.5)
{
ChArray[n][1] = "chip_05";
}
n++;
}
i++;
}
if(!this.multyLine)
{
var xPos = 0;
var yPos = 0;
var i = 0;
while(i < ChArray.length)
{
var n = 0;
while(n < ChArray[i][0])
{
var newChip = this.place.Targ.attachMovie(ChArray[i][1],ChArray[i][1] + "_" + (n + 1),d++);
newChip.movieTo(xPos,yPos);
yPos -= 3;
n++;
}
xPos += 1;
i++;
}
}
else
{
var d = 12;
var dSh = 0;
var c = 0;
var b = 0;
var i = 0;
while(i < ChArray.length)
{
var n = 0;
while(n < ChArray[i][0])
{
var newChip = this.place.Targ.attachMovie(ChArray[i][1],ChArray[i][1] + "_" + (n + 1),d++);
c = Math.floor(n / this.Chwh);
newChip.movieTo((i + b + c) * 17,- (n - c * this.Chwh) * 3);
n++;
}
this.place.Targ.attachMovie("chip_shadow","chip_shadow" + dSh,dSh++);
this.place.Targ["chip_shadow" + (dSh - 1)]._x = newChip._x;
b += c;
i++;
}
}
this.lastChip = newChip;
this.place.Targ.alignH();
if(!this.noSound && !noSound)
{
this.place.newSound("chip");
}
if(!this.multyLine && this.bet > 0)
{
this.place.Targ.attachMovie("chip_shadow","chip_shadow",-1).moveBy(5,-5);
}
return this.place;
};
C_ChipsCLASS.prototype.getPlace = function()
{
return this.place;
};
_global.makeChips = function(targMC, CashChips, multyLine)
{
if(multyLine != null)
{
targMC.multyLine = multyLine;
}
return targMC.setBet(CashChips);
};
Object.registerClass("C_ChipsCLASS",C_ChipsCLASS);
ASSetPropFlags(_global,"C_ChipsCLASS,makeChips",131);